import React from 'react'
import {NavLink,Navigate ,Routes,Route} from 'react-router-dom'
import Navigateto from './navigateto.js'
export default function Page5() {
  return (
    <div>  
      {/* 注意/形式是跳到根路由的下面 */}
    <NavLink to='Navigate'>重定向</NavLink>
    <NavLink to='Navigate1'>replace重定向</NavLink>
    <NavLink to='NavigateState'>重定向带state</NavLink>
    <Routes>
      {/* 子路由加/是代表根目录下的路由 Navigate也可以直接写名字 Navigate也支持.  不过这里写在route里面 所以上层是route里面的路径*/}
        <Route path="Navigate1" element={<Navigate replace={true} to='/Navigatefrom/Navigateto1'></Navigate>}></Route>
        <Route path="Navigate" element={<Navigate to='/Navigatefrom/Navigateto1'></Navigate>}></Route>
        <Route path="NavigateState" element={<Navigate state={{a:1}} to='/Navigatefrom/Navigateto1'></Navigate>}></Route>
        <Route path="Navigateto1" element={<Navigateto></Navigateto>}></Route>
    </Routes>
    </div>
  )
}
